package top.whq6.study.dao.impl;

import lombok.extern.slf4j.Slf4j;
import top.whq6.study.dao.CacheInfo;
import top.whq6.study.dao.StudentDao;
import top.whq6.study.entity.Student;

@Slf4j
public class StudentDaoImpl implements StudentDao {

  @Override
  public void addStu(Student s) {
    log.info("Add Student: {}", s);
    CacheInfo.STUDENT_CACHE.put(s.getId(), s);
  }

  @Override
  public void delStu(int stuId) {
    log.info("Delete Student id: {}", stuId);
    CacheInfo.STUDENT_CACHE.remove(stuId);
    log.info("Delete Student Success");
  }

  @Override
  public void modifyStu(Student s) {
    log.info("Modify Student info: {}", s);
    CacheInfo.STUDENT_CACHE.put(s.getId(), s);
    log.info("Modify Student Success");
  }
}
